//
// Created by xili on 2024/8/3 16:05.
// Go big or go home.
//
#include <vector>
#include <unordered_map>
#include <algorithm>

using namespace std;

class Solution {
public:
    vector<int> intersection(vector<vector<int>> &nums) {
        //统计每个数组中元素出现的次数
        unordered_map<int, int> ump;
        for (auto &item: nums) {
            for (auto &item1: item) {
                ump[item1]++;
            }
        }
        int n = nums.size();
        vector<int> ans;
        for (auto &item: ump) {
            if (item.second == n) {
                ans.emplace_back(item.first);
            }
        }
        sort(ans.begin(), ans.end());
        return ans;
    }
};